package com.srd.phone.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.shengrongdai.srd.R;
import com.srd.phone.bean.InviteFriends;
import com.srd.phone.utils.views.ViewHolder;

import java.util.ArrayList;
import java.util.List;

public class InviteFriendsAdapter extends BaseAdapter {

    private Context context;
    private List<InviteFriends> mList = new ArrayList<>(10);

    public InviteFriendsAdapter(Context context, List<InviteFriends> list) {
        this.context = context;
        this.mList = list;
    }

    public void setData(List<InviteFriends> list0) {
        mList = list0;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public InviteFriends getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        ViewHolder viewHolder =  ViewHolder.get(context, view, parent, R.layout.item_invite_friends, position);

        TextView tv_name = viewHolder.getView(R.id.tv_name);
        TextView tv_date = viewHolder.getView(R.id.tv_date);
        TextView tv_money = viewHolder.getView(R.id.tv_money);

        InviteFriends item = getItem(position);
        tv_name.setText(item.username);
        tv_date.setText(item.ctime);
        tv_money.setText(item.moneys + "元");

        return viewHolder.getConvertView();
    }


}
